﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactoryMode.Calculator
{
    /// <summary>
    /// 计算操作工厂类
    /// </summary>
    class OperationFactory
    {
        /// <summary>
        /// 创建操作对象
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        internal static Operation CreateOperation(OperationType type)
        {
            switch (type)
            {
                case OperationType.Addition:
                    return new OperationAddition();
                case OperationType.Subtraction:
                    return new OperationSubtract();
                case OperationType.Multiplication:
                    return new OperationMultiplication();
                case OperationType.Division:
                    return new OperationDivision();

            }
            return null;
        }
    }
}
